import cv2
cap=cv2.VideoCapture(0)
i=0
while True:
    ret,frame=cap.read()
    if ret:
        cv2.imshow("SHE像头",frame)
        k=cv2.waitKey(1)
       # print(k)
    if  k==ord(" "):
            print(k)
            break
      #  print(k)
    elif k == ord("s"):
     cv2.imwrite(f"{i}.jpg",frame)
     i = i + 1
